package a.f.j;

import a.c.d;
import a.c.e;
import a.c.m;
import a.c.q;
import a.c.w;
import a.c.x;

import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;

public class bb
  extends ab
  implements db
{
  private q h;
  private a.c.n i;
  private a.c.n j;
  private Map k;
  private x l;
  private boolean m;
  private ab n;
  public static int o;
  
  public bb(ab paramab)
  {
    this(paramab, null);
  }
  
  public bb(ab paramab, a.c.ab paramab1)
  {
    super(new q());
    this.n = paramab;
    this.h = this.n.a();
    m localm;
    if (!bool)
    {
      if (paramab1 != null)
      {
        localm = paramab1.l();
        do
        {
          if (!localm.e()) {
            break;
          }
          this.h.g(localm.a());
          localm.f();
          if ((!bool) && (i1 != 0)) {
            break label139;
          }
        } while (i1 == 0);
      }
      this.k = new HashMap();
      this.i = super.a().C();
      this.j = a.i.db.b();
    }
    if (!bool)
    {
      this.l = super.a().B();
      label139:
      if ((bool) || (paramab1 != null))
      {
        localm = paramab1.l();
        do
        {
          if (!localm.e()) {
            break;
          }
          this.h.f(localm.a());
          localm.f();
          if ((!bool) && (i1 != 0)) {
            return;
          }
        } while (i1 == 0);
      }
      if (bool) {}
    }
    else
    {
      p();
    }
  }
  
  public void n()
  {
    if ((ab.g) || ((this.n instanceof cb))) {
      ((cb)this.n).a(this);
    }
  }
  
  public void o()
  {
    if ((ab.g) || ((this.n instanceof cb))) {
      ((cb)this.n).b(this);
    }
  }
  
  public n a(e parame)
  {
    if (!ab.g) {
      if (!this.m) {
        throw new RuntimeException("Wrong execution order: call computeDualGraph() first!");
      }
    }
    return (n)this.l.get(parame);
  }
  
  public e b(n paramn)
  {
    if (!ab.g) {
      if (!this.m) {
        throw new RuntimeException("Wrong execution order: call computeDualGraph() first!");
      }
    }
    return (e)this.k.get(paramn);
  }
  
  public d j(d paramd)
  {
    if ((ab.g) || (this.m)) {
      return (d)this.i.get(paramd);
    }
    throw new RuntimeException("Wrong execution order: call computeDualGraph() first!");
  }
  
  public d k(d paramd)
  {
    if (!ab.g) {
      if (!this.m) {
        throw new RuntimeException("Wrong execution order: call computeDualGraph() first!");
      }
    }
    return (d)this.j.get(paramd);
  }
  
  public void p()
  {
    boolean bool = ab.g;
    int i2 = ab.f;
    q localq = a();
    localq.o();
    this.k.clear();
    o localo = this.n.b();
    n localn;
    e locale1;
    do
    {
      do
      {
        if (!localo.e()) {
          break;
        }
        localn = localo.a();
        locale1 = localq.i();
        a(localn, locale1);
        localo.f();
        if (bool) {
          break label105;
        }
        if (i2 != 0) {
          break label99;
        }
      } while (i2 == 0);
    } while (bool);
    localo = this.n.b();
    label99:
    label105:
    do
    {
      do
      {
        if (!localo.e()) {
          break;
        }
        localn = localo.a();
        locale1 = (e)this.k.get(localn);
        m localm = localn.a();
        if (i2 != 0) {
          break label380;
        }
        localm.i();
        do
        {
          do
          {
            if (!localm.e()) {
              break label309;
            }
            d locald1 = null;
            d locald2 = localm.a();
            d locald3 = this.n.b(locald2);
            locald1 = (d)this.j.get(locald3);
            e locale2 = (e)this.k.get(this.n.c(locald3));
            d locald4 = localq.a(locale1, locale2);
            if (i2 != 0) {
              break;
            }
            if (locald1 != null)
            {
              a(locald1, locald4);
              if (bool) {
                continue;
              }
              if ((locald1.e() != locald4.f()) && (locald1.f() != locald4.e())) {
                throw new RuntimeException(" ***** Error setting reverse edge *****");
              }
            }
            b(locald2, locald4);
            localm.g();
          } while (i2 == 0);
          localo.f();
        } while (bool);
      } while (i2 == 0);
    } while (bool);
    label309:
    if (!bool)
    {
      if (localq.m() != this.h.m()) {
        break label380;
      }
      if (bool) {
        break label377;
      }
    }
    label377:
    label380:
    int i1 = this.n.b.size() == this.k.size() ? 1 : 0;
    if (!bool)
    {
      if (i1 == 0) {
        throw new RuntimeException("Error computing dual graph!");
      }
      this.m = true;
    }
  }
  
  public void q()
  {
    boolean bool = ab.g;
    int i2 = ab.f;
    a.c.n localn = a.i.db.b(new int[this.h.l()]);
    f();
    Object localObject = b();
    label141:
    label143:
    do
    {
      if (!((o)localObject).e()) {
        break;
      }
      n localn1 = ((o)localObject).a();
      m localm = localn1.a();
      int i1 = 0;
      if (localm.e()) {}
      while (bool)
      {
        d locald = (d)this.i.get(localm.a());
        localn.a(this.n.b(locald), i1++);
        localm.f();
        if (bool) {
          break label143;
        }
        if (i2 != 0) {
          break label141;
        }
        if (i2 == 0) {
          break;
        }
      }
      ((o)localObject).f();
    } while (i2 == 0);
    do
    {
      localObject = this.h.v();
      while (i2 == 0)
      {
        if (!((w)localObject).e()) {
          break;
        }
        ((w)localObject).d().b(new Comparator()
        {
          private final a.c.n val$sortEdges;
          
          public int compare(Object paramAnonymousObject1, Object paramAnonymousObject2)
          {
            boolean bool = ab.g;
            d locald1 = (d)paramAnonymousObject1;
            d locald2 = (d)paramAnonymousObject2;
            int i = this.val$sortEdges.getInt(locald1);
            int j = this.val$sortEdges.getInt(locald2);
            if (!bool)
            {
              if (i == j) {
                return 0;
              }
              if (bool) {}
            }
            else if (i < j)
            {
              return 1;
            }
            return -1;
          }
        });
        ((w)localObject).f();
      }
    } while (bool);
  }
  
  public void a(d paramd, d[] paramArrayOfd)
  {
    boolean bool = ab.g;
    int i2 = ab.f;
    d locald1 = k(paramd);
    if (!bool) {
      if (locald1 == null) {
        return;
      }
    }
    d locald2 = this.n.b(paramd);
    n localn1 = this.n.c(paramd);
    e locale1 = b(localn1);
    n localn2 = this.n.c(locald2);
    e locale2 = b(localn2);
    d locald3 = k(locald2);
    Object localObject = locald1;
    d locald4 = locald3;
    int i1 = 0;
    do
    {
      if (i1 >= paramArrayOfd.length) {
        break;
      }
      d locald5 = paramArrayOfd[i1];
      d locald6 = this.n.b(locald5);
      d locald7 = this.a.a(locale1, (d)localObject, locale2, null, 0, 0);
      d locald8 = this.a.a(locale2, locald4, locale1, null, 1, 1);
      a(locald7, locald8);
      b(locald5, locald7);
      b(locald6, locald8);
      localObject = locald7;
      i1++;
      if ((!bool) && (i2 != 0)) {
        return;
      }
    } while (i2 == 0);
    this.j.a(paramd, null);
    this.j.a(locald2, null);
    this.a.a(locald1);
    this.a.a(locald3);
    if (!bool) {
      r();
    }
  }
  
  public void a(d[] paramArrayOfd, d paramd)
  {
    boolean bool = ab.g;
    int i2 = ab.f;
    d locald1 = this.n.b(paramd);
    n localn1 = this.n.c(paramd);
    e locale1 = b(localn1);
    n localn2 = this.n.c(locald1);
    e locale2 = b(localn2);
    d locald2 = this.a.a(locale1, locale2);
    d locald3 = this.a.a(locale2, locale1);
    a(locald2, locald3);
    b(paramd, locald2);
    b(locald1, locald3);
    int i1 = 0;
    do
    {
      if (i1 >= paramArrayOfd.length) {
        break;
      }
      d locald4 = paramArrayOfd[i1];
      d locald5 = this.n.b(locald4);
      d locald6 = k(locald4);
      d locald7 = k(locald5);
      this.j.a(locald4, null);
      this.j.a(locald5, null);
      this.a.a(locald6);
      this.a.a(locald7);
      i1++;
      if ((!bool) && (i2 != 0)) {
        return;
      }
    } while (i2 == 0);
    if (!bool) {
      r();
    }
  }
  
  public void a(d paramd, n[] paramArrayOfn1, n[] paramArrayOfn2)
  {
    boolean bool = ab.g;
    int i4 = ab.f;
    d locald1 = this.n.b(paramd);
    e[] arrayOfe1 = new e[paramArrayOfn1.length];
    int i1 = 0;
    do
    {
      do
      {
        if (i1 >= paramArrayOfn1.length) {
          break;
        }
        if ((!bool) && (i4 != 0)) {
          break label86;
        }
        arrayOfe1[i1] = ((e)this.k.get(paramArrayOfn1[i1]));
        i1++;
      } while (i4 == 0);
    } while (bool);
    label86:
    e[] arrayOfe2 = new e[paramArrayOfn2.length];
    int i2 = 0;
    do
    {
      while (i4 == 0)
      {
        if (i2 >= paramArrayOfn2.length) {
          break;
        }
        arrayOfe2[i2] = this.a.i();
        a(paramArrayOfn2[i2], arrayOfe2[i2]);
        i2++;
      }
    } while (bool);
    d locald2 = null;
    d locald3 = null;
    int i3 = 0;
    label361:
    label381:
    label383:
    do
    {
      if (i3 >= paramArrayOfn2.length) {
        break;
      }
      e locale = arrayOfe2[i3];
      if (bool) {
        break label415;
      }
      if (i4 != 0) {
        break label414;
      }
      m localm = paramArrayOfn2[i3].a();
      do
      {
        if (!localm.e()) {
          break;
        }
        d locald4 = localm.a();
        if (bool) {
          break label383;
        }
        if (i4 != 0) {
          break label381;
        }
        if (!bool)
        {
          if (locald4 == paramd)
          {
            locald2 = this.a.a(locale, b(this.n.c(locald1)));
            if (bool) {
              continue;
            }
            if (i4 == 0) {
              break label361;
            }
          }
          if (bool) {}
        }
        else if (locald4 == locald1)
        {
          locald3 = this.a.a(locale, b(this.n.c(paramd)));
          if (bool) {
            continue;
          }
          if (i4 == 0) {
            break label361;
          }
        }
        d locald5 = this.n.b(localm.a());
        d locald6 = k(locald4);
        d locald7 = k(locald5);
        this.a.a(locald6, locale, locald6.f());
        this.a.a(locald7, locald7.e(), locale);
        localm.f();
      } while (i4 == 0);
      if (!bool) {
        i3++;
      }
    } while (i4 == 0);
    a(locald2, locald3);
    b(paramd, locald2);
    if (!bool)
    {
      b(locald1, locald3);
      label414:
      label415:
      i3 = 0;
      if (i3 >= arrayOfe1.length) {}
    }
    while (bool)
    {
      this.a.a(arrayOfe1[i3]);
      i3++;
      if ((!bool) && (i4 != 0)) {
        return;
      }
      if (i4 == 0) {
        break;
      }
    }
    r();
  }
  
  public void b(d paramd, n[] paramArrayOfn1, n[] paramArrayOfn2)
  {
    boolean bool = ab.g;
    int i3 = ab.f;
    e[] arrayOfe1 = new e[paramArrayOfn1.length];
    int i1 = 0;
    do
    {
      do
      {
        if (i1 >= paramArrayOfn1.length) {
          break;
        }
        if ((!bool) && (i3 != 0)) {
          break label76;
        }
        arrayOfe1[i1] = ((e)this.k.get(paramArrayOfn1[i1]));
        i1++;
      } while (i3 == 0);
    } while (bool);
    label76:
    e[] arrayOfe2 = new e[paramArrayOfn2.length];
    int i2 = 0;
    do
    {
      do
      {
        if (i2 >= paramArrayOfn2.length) {
          break;
        }
        arrayOfe2[i2] = this.a.i();
        a(paramArrayOfn2[i2], arrayOfe2[i2]);
        i2++;
        if (bool) {
          break label141;
        }
        if (i3 != 0) {
          break label139;
        }
      } while (i3 == 0);
    } while (bool);
    i2 = 0;
    label139:
    label141:
    label285:
    label287:
    do
    {
      do
      {
        if (i2 >= paramArrayOfn2.length) {
          break;
        }
        e locale = arrayOfe2[i2];
        if (bool) {
          break label300;
        }
        if (i3 != 0) {
          break label298;
        }
        m localm = paramArrayOfn2[i2].a();
        do
        {
          if (!localm.e()) {
            break;
          }
          d locald1 = localm.a();
          d locald2 = this.n.b(localm.a());
          d locald3 = k(locald1);
          d locald4 = k(locald2);
          this.a.a(locald3, locale, locald3.f());
          this.a.a(locald4, locald4.e(), locale);
          localm.f();
          if (bool) {
            break label287;
          }
          if (i3 != 0) {
            break label285;
          }
        } while (i3 == 0);
        if (!bool) {
          i2++;
        }
      } while (i3 == 0);
    } while (bool);
    i2 = 0;
    label298:
    label300:
    if (i2 < arrayOfe1.length) {}
    while (bool)
    {
      this.a.a(arrayOfe1[i2]);
      i2++;
      if ((!bool) && (i3 != 0)) {
        return;
      }
      if (i3 == 0) {
        break;
      }
    }
    r();
  }
  
  public void i()
  {
    super.i();
    q localq = a();
    localq.a(this.i);
    localq.a(this.l);
    this.k.clear();
  }
  
  private void a(n paramn, e parame)
  {
    this.k.put(paramn, parame);
    this.l.a(parame, paramn);
  }
  
  private void b(d paramd1, d paramd2)
  {
    this.i.a(paramd2, paramd1);
    this.j.a(paramd1, paramd2);
  }
  
  protected void r() {}
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.j.bb

 * JD-Core Version:    0.7.0.1

 */